package com.gomore.opple.data.remote.api;

import com.gomore.opple.data.remote.bean.WrapperResponseEntity;
import com.gomore.opple.model.ActionResult;
import com.gomore.opple.model.ShippingAddressEntity;
import com.gomore.opple.model.StoreAddress;
import com.gomore.opple.rest.applybill.ApplyRequest;
import com.gomore.opple.rest.applybill.EarningsResponse;
import com.gomore.opple.rest.applybill.RsApplyBillRequest;
import com.gomore.opple.rest.applybill.RsApplyBillResponse;
import com.gomore.opple.rest.applybill.RsCommissionRequest;
import com.gomore.opple.rest.applybill.RsCommissionResponse;
import com.gomore.opple.rest.applybill.TOBankBindEntity;
import com.gomore.opple.rest.applybill.TOCommAuthEntity;
import com.gomore.opple.rest.consumer.ConsumerDesignerPageResult;
import com.gomore.opple.rest.consumer.ConsumerPageResult;
import com.gomore.opple.rest.consumer.ConsumerQueryCondition;
import com.gomore.opple.rest.employee.LoginInfo;
import com.gomore.opple.rest.employee.LoginResult;
import com.gomore.opple.rest.employee.ModifyPasswordRequest;
import com.gomore.opple.rest.employee.ResetPasswordRequest;
import com.gomore.opple.rest.employee.RsEmployeeRequest;
import com.gomore.opple.rest.goods.GoodsCondition;
import com.gomore.opple.rest.goods.GoodsFilter;
import com.gomore.opple.rest.goods.GoodsResponse;
import com.gomore.opple.rest.hottag.HotFilter;
import com.gomore.opple.rest.jdecard.RsJingDongECardRequest;
import com.gomore.opple.rest.jdecard.RsJingDongECardResponse;
import com.gomore.opple.rest.lottery.Draw;
import com.gomore.opple.rest.lottery.RsLotteryRequest;
import com.gomore.opple.rest.lottery.RsLotteryResponse;
import com.gomore.opple.rest.order.OrderBill;
import com.gomore.opple.rest.order.OrderFilter;
import com.gomore.opple.rest.order.OrderPayRequest;
import com.gomore.opple.rest.order.OrderResponse;
import com.gomore.opple.rest.order.RsOrderShareResponse;
import com.gomore.opple.rest.redPackage.RedPackageResponse;
import com.gomore.opple.rest.redPackage.RsRedPackageConditions;
import com.gomore.opple.rest.shopcart.DeleteCartRequest;
import com.gomore.opple.rest.shopcart.SaveShoppingCartRequest;
import com.gomore.opple.rest.shopcart.ShopCartFilter;
import com.gomore.opple.rest.shopcart.ShopCartResponse;
import com.gomore.opple.web.cgform.app.entity.TOAppversionEntity;
import com.gomore.opple.web.cgform.applybill.entity.TOApplyBillEntity;
import com.gomore.opple.web.cgform.consumer.entity.TOConsumerEntity;
import com.gomore.opple.web.cgform.goods.entity.TOGoodsEntity;
import com.gomore.opple.web.cgform.orderpromotion.entity.TOOrderPromotionEntity;
import com.gomore.opple.web.cgform.resellerstore.entity.TOResellerstoreEntity;
import com.gomore.opple.web.cgform.resellerstore.entity.ToStoreAddress;
import com.gomore.opple.web.cgform.shippingaddr.entity.TOShippingAddrEntity;
import com.gomore.opple.web.system.pojo.TOReseller;

import java.util.List;

import okhttp3.MultipartBody;
import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.GET;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.Part;
import retrofit2.http.Path;
import retrofit2.http.Query;
import rx.Observable;

public interface SaleHelperApi {
    /**
     * 升级接口
     *
     * @param apptype
     * @param version
     * @return
     */
    @GET("employee/getUpgrade")
    Observable<WrapperResponseEntity<TOAppversionEntity>> checkUpdate(@Query("apptype") String apptype, @Query("version") String version);

    /**
     * 登录请求
     *
     * @param loginInfo
     * @return
     */
    @POST("employee/login")
    Observable<WrapperResponseEntity<LoginResult>> login(@Body LoginInfo loginInfo);

    /**
     * 重置密码
     *
     * @param resetPasswordRequest
     * @return
     */
    @POST("employee/resetPassword")
    Observable<WrapperResponseEntity<String>> restPassword(@Body ResetPasswordRequest resetPasswordRequest);

    /**
     * 发送验证码
     *
     * @param mobilephone
     * @param username
     * @return
     */
    @GET("system/sendSms")
    Observable<WrapperResponseEntity<String>> sendCode(@Query("mobilephone") String mobilephone, @Query("username") String username);

    /**
     * 同步登录请求
     *
     * @param loginInfo
     * @return
     */
    @POST("employee/login")
    Call<WrapperResponseEntity<LoginResult>> loginSyn(@Body LoginInfo loginInfo);

    /**
     * 获取客户
     *
     * @param consumerQueryCondition
     * @return
     */
    @POST("consumer/query")
    Observable<WrapperResponseEntity<ConsumerDesignerPageResult>> getConsumer(@Body ConsumerQueryCondition consumerQueryCondition);

    /**
     * 保存客户访问时间
     *
     * @param consumerId
     * @return
     */
    @GET("consumer/saveLastVisitedTime")
    Observable<WrapperResponseEntity<String>> saveLastVisitedTime(@Query("consumerId") String consumerId);

    /**
     * 保存客户
     *
     * @param toConsumerEntity
     * @return
     */
    @POST("consumer/save")
    Observable<WrapperResponseEntity<String>> save(@Body TOConsumerEntity toConsumerEntity);

    /**
     * 查询商品
     *
     * @param goodsCondition
     * @return
     */
    @POST("goods/query")
    Observable<WrapperResponseEntity<GoodsResponse>> queryGoods(@Body GoodsCondition goodsCondition);

    /**
     * 获取所有筛选条件
     *
     * @return
     */
    @GET("goods/getGoodsFilter")
    Observable<WrapperResponseEntity<GoodsFilter>> getGoodsFilter();

    /**
     * 获取单个商品
     *
     * @return
     */
    @GET("goods/getGoods/{goodsId}")
    Observable<WrapperResponseEntity<TOGoodsEntity>> getGoodById(@Path("goodsId") String goodId);

    /**
     * 添加到购物车
     *
     * @param saveShoppingCartRequest
     * @return
     */
    @POST("shopcart/save")
    Observable<WrapperResponseEntity<String>> addToShoppingCar(@Body SaveShoppingCartRequest saveShoppingCartRequest);

    /**
     * 获取热门推荐
     *
     * @return
     */
    @GET("hottag/getHotTag")
    Observable<WrapperResponseEntity<HotFilter>> getHotTag();

    /**
     * 查询购物车
     *
     * @param shopCartFilter
     * @return
     */
    @POST("shopcart/query")
    Observable<WrapperResponseEntity<ShopCartResponse>> queryShoppingCar(@Body ShopCartFilter shopCartFilter);

    /**
     * 更改成交价
     *
     * @return
     */
    @POST("shopcart/updateCostPrice")
    Observable<WrapperResponseEntity<String>> updateCostPrice(@Query("cartId") String cartId, @Query("costPrice") String costPrice,
                                                              @Query("goodsId") String goodsId, @Query("goodsNum") String goodsNum);

    /**
     * 删除购物车
     *
     * @return
     */
    @POST("shopcart/delete")
    Observable<WrapperResponseEntity<String>> deleteShoppingCar(@Body DeleteCartRequest deleteCartRequest);

    /**
     * 查询收货地址
     *
     * @return
     */
    @GET("shippingAddress/listAddress/{consumerUuid}")
    Observable<WrapperResponseEntity<ShippingAddressEntity>> getShippingAddress(@Path("consumerUuid") String consumerUuid);

    /**
     * 保存收货地址
     *
     * @return
     */
    @POST("shippingAddress/save")
    Observable<WrapperResponseEntity<String>> saveShippingAddress(@Body TOShippingAddrEntity toShippingAddrEntity);

    /**
     * 更新收货地址
     *
     * @return
     */
    @POST("shippingAddress/update")
    Observable<WrapperResponseEntity<String>> updateShippingAddress(@Body TOShippingAddrEntity toShippingAddrEntity);

    /**
     * 删除收货地址
     *
     * @return
     */
    @GET("shippingAddress/remove/{shippingUuid}")
    Observable<WrapperResponseEntity<String>> removeShippingAddress(@Path("shippingUuid") String shippingUuid);

    /**
     * 获取订单
     *
     * @return
     */
    @GET("order/findOrder/{order_number}")
    Observable<WrapperResponseEntity<OrderBill>> getOrderByNumber(@Path("order_number") String order_number);

    /**
     * 保存订单
     *
     * @return
     */
    @POST("order/save")
    Observable<WrapperResponseEntity<String>> saveOrder(@Body OrderBill orderBill);

    /**
     * 上传附件
     *
     * @return
     */
    @Multipart
    @POST("system/upload")
    Observable<WrapperResponseEntity<String>> uploadAttachment(@Part MultipartBody.Part file);

    /**
     * 获取促销结果
     *
     * @return
     */
    @GET("promotion/calc")
    Observable<WrapperResponseEntity<ActionResult>> getCalc(@Query("orderNumber") String orderNumber);

    /**
     * 获取经营者二维码
     *
     * @return
     */
    @GET("employee/getReseller")
    Observable<WrapperResponseEntity<TOReseller>> getReseller();

    /**
     * 支付订单
     *
     * @return
     */
    @POST("order/payOrder")
    Observable<WrapperResponseEntity<String>> payOrder(@Body OrderPayRequest orderPayRequest);

    /**
     * 分享订单
     *
     * @return
     */
    @POST("order/OrderShare/{order_number}")
    Observable<WrapperResponseEntity<RsOrderShareResponse>> orderShare(@Path("order_number") String order_number);

    /**
     * 删除购物车
     *
     * @return
     */
    @POST("shopcart/delete")
    Observable<WrapperResponseEntity<String>> deleteCart(@Body DeleteCartRequest deleteCartRequest);

    /**
     * 修改订单状态
     *
     * @return
     */
    @GET("order/updateOrderState/{order_number}/{oldstate}/{newstate}")
    Observable<WrapperResponseEntity<String>> updateOrderState(@Path("order_number") String order_number,
                                                               @Path("oldstate") String oldstate,
                                                               @Path("newstate") String newstate);

    /**
     * 获取我的信息
     *
     * @return
     */
    @GET("applybill/getTotal/{employeeId}")
    Observable<WrapperResponseEntity<EarningsResponse>> getTotal(@Path("employeeId") String employeeId);

    /**
     * 验证银行卡
     *
     * @return
     */
    @POST("applybill/commAuth")
    Observable<WrapperResponseEntity<String>> commAuth(@Body TOCommAuthEntity toCommAuthEntity);

    /**
     * 绑定银行卡
     *
     * @return
     */
    @POST("applybill/bind")
    Observable<WrapperResponseEntity<String>> bind(@Body TOBankBindEntity toBankBindEntity);

    /**
     * 绑定银行卡，发送验证码
     *
     * @param mobilephone
     * @param username
     * @return
     */
    @GET("system/bankCardBindSendSms")
    Observable<WrapperResponseEntity<String>> bankCardBindSendSms(@Query("mobilephone") String mobilephone, @Query("username") String username);

    /**
     * 解绑银行卡
     *
     * @param bankAccount
     * @return
     */
    @GET("applybill/unbind/{bankAccount}")
    Observable<WrapperResponseEntity<String>> unbind(@Path("bankAccount") String bankAccount);

    /**
     * 提现申请保存
     *
     * @return
     */
    @POST("applybill/save")
    Observable<WrapperResponseEntity<String>> applySave(@Body ApplyRequest applyRequest);

    /**
     * 查询收支明细
     *
     * @return
     */
    @POST("applybill/queryCommission")
    Observable<WrapperResponseEntity<RsCommissionResponse>> queryIncomeAndExpense(@Body RsCommissionRequest rsCommissionRequest);

    /**
     * 查询提现进度明细
     *
     * @return
     */
    @POST("applybill/queryApplyBill")
    Observable<WrapperResponseEntity<RsApplyBillResponse>> queryApply(@Body RsApplyBillRequest rsApplyBillRequest);

    /**
     * 查询京东E卡
     *
     * @return
     */
    @POST("jingdongecard/query")
    Observable<WrapperResponseEntity<RsJingDongECardResponse>> queryJDE(@Body RsJingDongECardRequest rsJingDongECardRequest);

    /**
     * 激活京东E卡
     *
     * @return
     */
    @POST("jingdongecard/active")
    Observable<WrapperResponseEntity<String>> activeJDE(@Query("orderNumber") String orderNumber,
                                                        @Query("orderReceiptUrl") String orderReceiptUrl);

    /**
     * 使用京东E卡
     *
     * @return
     */
    @POST("jingdongecard/use")
    Observable<WrapperResponseEntity<String>> useJDE(@Query("cardNumber") String cardNumber);

    /**
     * 查询我的抽奖
     *
     * @return
     */
    @POST("lottery/query")
    Observable<WrapperResponseEntity<RsLotteryResponse>> queryAward(@Body RsLotteryRequest rsLotteryRequest);

    /**
     * 去抽奖
     *
     * @return
     */
    @POST("lottery/draw")
    Observable<WrapperResponseEntity<String>> drawAward(@Body Draw draw);

    /**
     * 激活红包
     *
     * @return
     */
    @POST("redPackage/uploadNote")
    Observable<WrapperResponseEntity<String>> activeRedPackage(@Query("orderNumber") String orderNumber,
                                                               @Query("orderReceiptUrl") String orderReceiptUrl);

    /**
     * 查询红包
     *
     * @return
     */
    @POST("redPackage/query")
    Observable<WrapperResponseEntity<RedPackageResponse>> queryRedPackage(@Body RsRedPackageConditions rsRedPackageConditions);

    /**
     * 查询订单
     *
     * @return
     */
    @POST("order/query")
    Observable<WrapperResponseEntity<OrderResponse>> queryOrder(@Body OrderFilter orderFilter);

    /**
     * 退出登录
     *
     * @return
     */
    @GET("employee/logout")
    Observable<WrapperResponseEntity<String>> logout();

    /**
     * 修改密码
     *
     * @return
     */
    @POST("employee/modifyPassword")
    Observable<WrapperResponseEntity<String>> modifyPassword(@Body ModifyPasswordRequest modifyPasswordRequest);

    /**
     * 保存门店代码
     *
     * @return
     */
    @POST("resellerStore/saveResellerStore")
    Observable<WrapperResponseEntity<String>> saveResellerStore(@Body TOResellerstoreEntity toResellerstoreEntity);

    /**
     * 保存门店地址
     *
     * @return
     */
    @POST("resellerStore/saveStoreAddress")
    Observable<WrapperResponseEntity<String>> saveStoreAddress(@Body ToStoreAddress toStoreAddress);

    /**
     * 获取购物车的数量
     *
     * @return
     */
    @GET("shopcart/get")
    Observable<WrapperResponseEntity<String>> getShoppingCarNumber(@Query("consumerId") String consumerId);

    /**
     * 通过条形码获取商品
     *
     * @return
     */
    @GET("goods/getGoodsByCode/{barcode}")
    Observable<WrapperResponseEntity<TOGoodsEntity>> getGoodsByCode(@Path("barcode") String barcode);

    /**
     * 修改员工资料
     *
     * @return
     */
    @POST("employee/updateEmployee")
    Observable<WrapperResponseEntity<String>> updateEmployee(@Body RsEmployeeRequest rsEmployeeRequest);

    /**
     * 获取提现进度明细
     *
     * @return
     */
    @GET("applybill/getDetailState/{uuid}")
    Observable<WrapperResponseEntity<TOApplyBillEntity>> getDetailState(@Path("uuid") String uuid);

    /**
     * 促销记录
     *
     * @return
     */
    @GET("orderpromotion/get/{orderNumber}")
    Observable<WrapperResponseEntity<List<TOOrderPromotionEntity>>> getOrderPromotion(@Path("orderNumber") String orderNumber);

    /**
     * 获取门店地址
     *
     * @return
     */
    @POST("resellerStore/getStoreAddress/{currentDepartId}")
    Observable<WrapperResponseEntity<StoreAddress>> getStoreAddress(@Path("currentDepartId") String currentDepartId);
}
